import React from "react";
import HelloWorld from "./HelloWorld";

export default class App extends React.Component {
    constructor() {
        console.log()
        super();
        console.log("App constructor");
        this.state = {
            message: "Hello App"
        }
    }

    render() {
        console.log("App render");
        const {message} = this.state;
        return (
            <div>{message}
                <HelloWorld/>
            </div>

        )

    }

    componentDidMount() {
        console.log("App componentDidMount");
    }

// 组件更新时调用
    componentDidUpdate(prevProps, prevState, snapshot) {
        // 打印日志
        console.log("App componentDidUpdate");
    }
}